/**
*****************************************************************************
 * DESC ：. 
 * Author : Junwei Zhang 
 * CREATEDATE ：2012-8-10 
 * MODIFYLIST ：       	Name 			 Date 			Reason/Contents
 * 				------------------------------------------------------ 
 * 				 	Junwei Zhang     2012-8-10		Created.
 ****************************************************************************
**/
package com.me.client;

import java.util.ArrayList;
import java.util.List;

import com.me.client.JTalkClient.MemberData;

/**
 * 
 * <br/> 下午6:58:33 2012-8-10
 * @Author <a href="mailto:mestudying@sina.com">Junwei Zhang</a><br/>
 **/
public class JTalkClientPluginConnector {
	
	private JTalkClientFront parent = null;

	public JTalkClientPluginConnector(JTalkClientFront parent) {
		// TODO Auto-generated constructor stub
		this.parent = parent;
	}

	/**
	 * 获取所有在线用户.
	 * @return
	 */
	public List<String> getOnlineUsers() {
		List<String> onlineUsers = new ArrayList<String>();
		for(MemberData m : this.parent.theClient.allMembers){
			if(!m.short_name.equals(this.getUserName())){
				onlineUsers.add(m.short_name);
			}
		}
		return onlineUsers;
	}	

	/**
	 * 获取当前用户.
	 * @return
	 */
	public String getUserName() {
		return this.parent.theClient.userName;
	}

	/**
	 * 发送消息.
	 * @param content
	 * @param to
	 * @param type
	 * @param description
	 * @param id
	 * @return
	 */
	public boolean sendMessage(String content, String to, String type, String description, String id) {
		return this.parent.theClient.sendMessage(content, to, type, description, id);
	}

	/**
	 * 注册命令.
	 * @param command
	 */
	public void registerForCommandResponse(JTalkClientCommandInterface command) {
		this.parent.theClient.registerForCommandResponse(command);
	}

	/**
	 * 注销命令.
	 * @param command
	 */
	public void deRegisterForCommandResponse(JTalkClientCommandInterface command) {
		this.parent.theClient.deRegisterForCommandResponse(command);
		
	}

}
